package com.aim.analysis.records;

import com.aim.analysis.questionnaire.QuestionnaireRecord;

import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;

/**
 * User: Avraham Shvartzon
 * Date: 6/18/14
 */
public class HitUtil {

    public static List<Game> flattGames(Collection<Hit> hits){
        List<Game> games = new LinkedList<Game>();
        for (Hit hit : hits) {
            if (hit.gameList != null){
                games.addAll(hit.gameList);
            } else {
                System.out.println("missed games: " + hit.assignmentId);
            }
        }
        return games;
    }

    public static List<QuestionnaireRecord> getQuestionnaireRecords(Collection<Hit> hits){
        List<QuestionnaireRecord> records = new LinkedList<QuestionnaireRecord>();
        for (Hit hit : hits) {
            records.add(hit.questionnaireRecord);
        }
        return records;
    }
}
